package chapter4.read

import java.sql.DriverManager

import chapter4.Person
import org.apache.spark.rdd.JdbcRDD
import org.apache.spark.{SparkConf, SparkContext}

object Chapter4_3_7 extends App {


  val conf = new SparkConf().setMaster("local").setAppName(this.getClass.getName)

  val sc = new SparkContext(conf)

  new JdbcRDD[Person](sc, () => {
    Class.forName("")
    DriverManager.getConnection("jdbc:mysql://mysql01:3306/bigdata?useUnicode=true&characterEncoding=utf8", "root", "root")
  }, "",1, 3, 3, r=>new Person(r.getString(1), r.getInt(2)))

}
